package com.qyhl.webtv.module_circle.circle.moment;


import com.qyhl.webtv.commonlib.entity.circle.CircleHomeBean;
import com.qyhl.webtv.commonlib.entity.intergral.CoinBean;

import java.util.List;

/**
 * Created by qyhl on 2018/1/18.
 */

public class CircleMomentPresenter implements CircleMomentContract.CircleMomentPresenter {
    private CircleMomentModel mModel;
    private CircleMomentFragment mView;

    public CircleMomentPresenter(CircleMomentFragment mView) {
        this.mView = mView;
        this.mModel = new CircleMomentModel(this);
    }

    @Override
    public void getContent(String username, String lastTopicId) {
        mModel.getContent(username, lastTopicId);
    }

    @Override
    public void setContent(List<CircleHomeBean> beanList, boolean isMore) {
        mView.setContent(beanList, isMore);
    }

    @Override
    public void sendComment(String topicId, String content, String dstUsername) {
        mModel.sendComment(topicId, content, dstUsername);
    }

    @Override
    public void setError(int code, String msg) {
        switch (code) {
            case 0:
                mView.setNetError(msg);
                break;
            case 1:
                mView.showMessage(msg);
                break;
            case 2:
                mView.setEmpty(msg);
                break;
            case 3:
                mView.setLog(msg);
                break;
            case 4:
                mView.setError(msg);
                break;
            case 5:
                mView.showMessage(msg);
                break;
            default:
                break;
        }
    }

    @Override
    public void commentSuccess(int id,String msg, int code) {
        mView.commentSuccess(id,msg, code);
    }

    @Override
    public void commentError(String msg) {
        mView.commentError(msg);
    }

    @Override
    public void getCommentCoin() {
        mModel.getComCoin();
    }

    @Override
    public void getCoinSuccess(CoinBean coinBean) {
        mView.getCoinSuccess(coinBean);
    }

    @Override
    public void getCoinError(String msg) {
        mView.getCoinError(msg);
    }

}
